[[tags: manual]]

[[toc:]]

== Non-standard read syntax

=== Escapes in symbols

{{| ... |}} may be used to escape a sequence of characters when reading a symbol.
{{\X}} escapes a single character in a symbols name:

  (symbol->string '|abc def|)       =>   "abc def"
  (symbol->string '|abc||def|)      =>   "abcdef"
  (symbol->string '|abc|xyz|def|)   =>   "abcxyzdef"
  (symbol->string '|abc\|def|)      =>   "abc|def"
  (symbol->string 'abc\ def)        =>   "abc def"

=== Multiline Block Comment

 #| ... |# 

A multiline ''block'' comment. May be nested. Implements [[http://srfi.schemers.org/srfi-30/srfi-30.html|SRFI-30]]

=== Expression Comment

 #;EXPRESSION

Treats {{EXPRESSION}} as a comment.  That is, the comment runs through the whole S-expression, regardless of newlines, which saves you from having to comment out every line, or add a newline in the middle of your parens to make the commenting of the last line work, or other things like that.
=== External Representation

 #,(CONSTRUCTORNAME DATUM ...)

Allows user-defined extension of external representations. (For more information see the documentation for
[[http://srfi.schemers.org/srfi-10/srfi-10.html|SRFI-10]])

=== Location Expression

 #$EXPRESSION

An abbreviation for {{(location EXPRESSION)}}.

=== Keyword

 #:SYMBOL
 SYMBOL:
 :SYMBOL

Syntax for keywords. Keywords are symbols that evaluate to themselves, and as such don't have to be quoted.  Either {{SYMBOL:}} or {{:SYMBOL}} is accepted, depending on the setting of the {{keyword-style}} parameter, but never both.  {{#:SYMBOL}} is always accepted.

=== Multiline String Constant

 #<<TAG

Specifies a multiline string constant. Anything up to a line equal to {{TAG}} (or end of file) will be returned as a single string:

 (define msg #<<END
  "Hello, world!", she said.
 END
 )

is equivalent to

 (define msg "\"Hello, world!\", she said.")

=== Multiline String Constant with Embedded Expressions

 #<#TAG

Similar to {{#<<}}, but allows substitution of embedded Scheme expressions prefixed with {{#}} and optionally enclosed in curly brackets. Two consecutive {{#}}s are translated to a single {{#}}:

 (define three 3)
 (display #<#EOF
 This is a simple string with an embedded `##' character
 and substituted expressions: (+ three 99) ==> #(+ three 99)
 (three is "#{three}")
 EOF
 )

prints

 This is a simple string with an embedded `#' character
 and substituted expressions: (+ three 99) ==> 102
 (three is "3")

=== Foreign Declare

 #> ... <#

Abbreviation for {{foreign-declare " ... ")}}.

=== Sharp Prefixed Symbol

 #%... 

Reads like a normal symbol.

=== Bang

 #!... 

Interpretation depends on the directly following characters. Only the following are recognized. Any other case results in a read error.

==== Line Comment

* If followed by whitespace or a slash, then everything up the end of the current line is ignored

==== Eof Object

* If followed by the character sequence {{eof}}, then the (self-evaluating) end-of-file object is returned

==== DSSSL Formal Parameter List Annotation

* If followed by any of the character sequences {{optional}}, {{rest}} or {{key}}, then a symbol with the same name (and prefixed with {{#!}}) is returned

==== Read Mark Invocation

* If a ''read mark'' with the same name as the token is registered, then its procedure is called and the result of the read-mark procedure will be returned

=== Case Sensitive Expression

 #cs...

Read the next expression in case-sensitive mode (regardless of the current global setting).

=== Case Insensitive Expression

 #ci...

Read the next expression in case-insensitive mode (regardless of the current global setting).

=== Conditional Expansion

 #+FEATURE EXPR

Equivalent to 

 (cond-expand (FEATURE EXPR) (else))

---
Previous: [[Extensions to the standard]]

Next: [[Non-standard macros and special forms]]
